package com.example.k8s.hello.bean.exam.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.k8s.hello.bean.exam.constant.EdConstant;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 考试
 *
 * @author Mark sunlightcs@gmail.com
 */
@Data
@Accessors(chain = true)
@TableName("ed_exam")
@Schema(description = "考试")
public class EdExamEntity {
	@TableId
	private Long examId;

	@Schema(description = "用户ID")
	private Long userId;

	@Schema(description = "用户学号")
	private String username;

	@Schema(description = "用户姓名")
	private String nickname;

	@Schema(description = "考试科目")
	private EdConstant.SubjectType subject;

	@Schema(description = "考试场景")
	private EdConstant.SceneType scene;

	@Schema(description = "血量")
	private BigDecimal hp;

	@Schema(description = "考试是否通过")
	private Boolean pass;

	@Schema(description = "考试成绩")
	private Integer score;

	@Schema(description = "创建时间")
	@TableField(fill = FieldFill.INSERT)
	private Date createTime;

	@Schema(description = "考试内容")
	public String getLabel() {
		return scene.label + subject.label + "考核";
	}
}
